<?php
require_once "config.php";
$id = $_GET['id'];
$title = $_POST['title'];
$content = getContent($_POST['content']);
$time = time();
if($title!=""&&$content!=""){
    $sql = "update about set title='{$title}',content='{$content}',time={$time} where id = $id";
    $rst = mysqli_query($con,$sql);
    $num = mysqli_affected_rows($con);
    if($num){
        echo "<script>alert('编辑成功!');window.location.href='about_list.php';</script>";
    }else{
        echo "<script>alert('编辑失败,请重新输入');window.location.href='about_edit.php?id={$id}';</script>";
    }
}else{
    echo "<script>alert('不能为空,请重新输入');window.location.href='about_edit.php?id={$id}';</script>";
}